{extend name="public/base" /} {block name="body"}
<div class="ibox float-e-margins">
	<div class="content-tabs">
		<ol class="breadcrumb">
			<li>
				<a href="{:url('index/index')}"><i class="fa fa-home"></i></a>
			</li>
			<li><strong>访问量统计</strong></li>
		</ol>
	</div>
	<div class="ibox-content">
		<form id="myForm" class="form-horizontal m-t" method="post" action="{:url('index')}">
			<!--统计图-->
			<div id="main" style="width: 98%;height:500px;"></div>
		</form>
	</div>

</div>
{/block} {block name="script"}
<script src="__JS__/jquery.form.js"></script>-
<script src="__LIB__/validate/jquery.validate.min.js"></script>
<script src="__LIB__/validate/messages_zh.min.js"></script>
<script src="__LIB__/validate/add_validate.min.js"></script>
<script src="__LIB__/fileinput/js/fileinput.min.js"></script>
<script src="__LIB__/fileinput/js/locales/zh.js"></script>
<script src="__JS__/echarts.common.min.js"></script>
<style>
	.order-info .info-group {
		width: 25%;
		text-align: center;
		float: left;
	}
	
	.order-info .info-group+.info-group {
		border-left: 1px dotted #ccc;
	}
	
	.h4 {
		font-size: 22px;
		display: block;
	}
</style>
<script type="text/javascript">
	var num = [];
	var time = [];
	var arr = <?php echo json_encode($list);?>;
	var aarr = eval(arr);
	for(var i = 0; i < aarr.length; i++) {
		num[i] = aarr[i].current_PV;
		time[i] = aarr[i].addtime;
	}
</script>
<script>
	var myChart = echarts.init(document.getElementById('main'));

	option = {
		title: {
			text: '访问量统计'
		},
		tooltip: {
			trigger: 'axis'
		},
		legend: {
			data: ['首页访问量']
		},
		grid: {
			left: '3%',
			right: '4%',
			bottom: '3%',
			containLabel: true
		},
		toolbox: {
			feature: {
				saveAsImage: {}
			}
		},
		xAxis: {
			type: 'category',
			boundaryGap: false,
			data: [
				time['0'] ? time['0'] : "今天没有人访问哦",
				time['1'] ? time['1'] : "今天没有人访问哦",
				time['2'] ? time['2'] : "今天没有人访问哦",
				time['3'] ? time['3'] : "今天没有人访问哦",
				time['4'] ? time['4'] : "今天没有人访问哦",
				time['5'] ? time['5'] : "今天没有人访问哦",
				time['6'] ? time['6'] : "今天没有人访问哦"
			]
		},
		yAxis: {
			type: 'value'
		},
		series: [{
			name: '首页访问量',
			type: 'line',
			stack: '总量',
			data: [
				num['0'],
				num['1'],
				num['2'],
				num['3'],
				num['4'],
				num['5'],
				num['6']
			]
		}]
	};

	myChart.setOption(option);
</script>
{/block}